package com.relytosoft.mizar.media.common.enums;

import java.util.Objects;

/**
 * @author zyc
 * @version 1.0
 * @date 2022/5/26 18:57
 */
public enum TaskTypeEnum {

    REAL_TIME("实时任务", 1),

    OFF_LINE_VIDEO("离线视频任务", 2),

    OFF_LINE_FILE("离线文件任务", 3);


    String name;
    int value;


    TaskTypeEnum(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public static TaskTypeEnum getByValue(Integer value) {
        if (Objects.isNull(value)) {
            return null;
        }

        TaskTypeEnum[] values = TaskTypeEnum.values();
        for (TaskTypeEnum taskStatusEnum : values) {
            if (Objects.equals(value, taskStatusEnum.getValue())) {
                return taskStatusEnum;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return "TaskTypeEnum{" +
                "name='" + name + '\'' +
                ", value=" + value +
                '}';
    }
}
